/**
 *
 *  Copyright (C) 2010 SYSNET International, Inc. <support@sysnetint.com>
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 *  implied. See the License for the specific language governing
 *  permissions and limitations under the License.
 *
 */
package org.openhie.openempi.blocking.basicblocking;

import java.util.ArrayList;
import java.util.List;

import org.openhie.openempi.configuration.BaseFieldPair;
import org.openhie.openempi.model.BaseObject;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

public class BlockingRound extends BaseObject
{
	private static final long serialVersionUID = 6836460519679990976L;

	private List<BaseFieldPair> fields;
	
	public BlockingRound() {
		fields = new ArrayList<BaseFieldPair>();
	}
	
	public void addField(BaseFieldPair field) {
		fields.add(field);
	}
	
	public void addField(String leftField, String rightField) {
		fields.add(new BaseFieldPair(leftField, rightField));
	}
	
	public List<BaseFieldPair> getFields() {
		return fields;
	}

	public void setFields(List<BaseFieldPair> fields) {
		this.fields = fields;
	}

	@Override
	public boolean equals(final Object other) {
		if (!(other instanceof BlockingRound))
			return false;
		BlockingRound castOther = (BlockingRound) other;
		return new EqualsBuilder().append(fields, castOther.fields).isEquals();
	}

	@Override
	public int hashCode() {
		return new HashCodeBuilder().append(fields).toHashCode();
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this).append("fields", fields).toString();
	}
}
